package world.gameMenager;



import utility.Color;
import utility.Point;
import world.Piece;
import world.pieces.King;
import world.player.Player;

public class Castling {
	private boolean firstMoveBlackKing=false;
	private boolean firstMoveWhiteKing=false;
	private boolean firstMoveBlackRockLeft=false;
	private boolean firstMoveBlackRockRight=false;
	private boolean firstMoveWhiteRockLeft=false;
	private boolean firstMoveWhiteRockRight=false;
	
	public Castling() {
		// TODO Auto-generated constructor stub
	}
	
	
	
	
	
	
	public boolean isFirstMoveBlackKing() {
		return firstMoveBlackKing;
	}
	public void setFirstMoveBlackKing(boolean firstMoveBlackKing) {
		this.firstMoveBlackKing = firstMoveBlackKing;
	}
	public boolean isFirstMoveWhiteKing() {
		return firstMoveWhiteKing;
	}
	public void setFirstMoveWhiteKing(boolean firstMoveWhiteKing) {
		this.firstMoveWhiteKing = firstMoveWhiteKing;
	}
	public boolean isFirstMoveBlackRockLeft() {
		return firstMoveBlackRockLeft;
	}
	public void setFirstMoveBlackRockLeft(boolean firstMoveBlackRockLeft) {
		this.firstMoveBlackRockLeft = firstMoveBlackRockLeft;
	}
	public boolean isFirstMoveBlackRockRight() {
		return firstMoveBlackRockRight;
	}
	public void setFirstMoveBlackRockRight(boolean firstMoveBlackRockRight) {
		this.firstMoveBlackRockRight = firstMoveBlackRockRight;
	}
	public boolean isFirstMoveWhiteRockLeft() {
		return firstMoveWhiteRockLeft;
	}
	public void setFirstMoveWhiteRockLeft(boolean firstMoveWhiteRockLeft) {
		this.firstMoveWhiteRockLeft = firstMoveWhiteRockLeft;
	}
	public boolean isFirstMoveWhiteRockRight() {
		return firstMoveWhiteRockRight;
	}
	public void setFirstMoveWhiteRockRight(boolean firstMoveWhiteRockRight) {
		this.firstMoveWhiteRockRight = firstMoveWhiteRockRight;
	}






	public boolean isCastlingBlackRight(Player currentPlayer, Point from, Point to, Piece[][] matrix) {
		if(currentPlayer.getColor().equals(Color.BLACK)){
			if(matrix[to.getX()][to.getY()] instanceof King){
				if(to.getY()-from.getY()==2){
					return true;
				}
			}
		}
		return false;
		
	}






	public boolean isCastlingBlackLeft(Player currentPlayer, Point from, Point to, Piece[][] matrix) {
		if(currentPlayer.getColor().equals(Color.BLACK)){
			if(matrix[to.getX()][to.getY()] instanceof King){
				if(to.getY()-from.getY()==-2){
					return true;
				}
			}
		}
		return false;
	}






	public boolean isCastlingWhiteRight(Player currentPlayer, Point from,Point to, Piece[][] matrix) {
		if(currentPlayer.getColor().equals(Color.WHITE)){
			if(matrix[to.getX()][to.getY()] instanceof King){
				if(to.getY()-from.getY()==2){
					return true;
				}
			}
		}
		return false;
		
	}






	public boolean isCastlingWhiteLeft(Player currentPlayer, Point from, Point to,Piece[][] matrix) {
		if(currentPlayer.getColor().equals(Color.WHITE)){
			if(matrix[to.getX()][to.getY()] instanceof King){
				if(to.getY()-from.getY()==-2){
					return true;
				}
			}
		}
		return false;
		
	}
	

}
